package com.jic.member.exception;

/**
 * description: BussinessExcetionEnum
 * date: 2020/3/9 15:30
 * author: wangys
 * version: 1.0
 */
public enum BussinessExcetionEnum {
    PARAM_ERROR("1000", "参数错误"),
    INVOKE_ERROR("1001", "调用错误"),
    REMOTE_SERVICE_ERROR("1002", "远程服务异常"),
    BINDING_ERROR("9999", "操作绑卡解卡异常"),
    BIND_ERROR("9999", "该会员已绑定本折扣卡，不能重复绑定"),
    UNITE_ERROR("9999", "解绑失败，请刷新页面"),
    BINDED_ERROR("9999", "此卡已经被绑定，请刷新页面"),
    ;

    private String code;
    private String msg;

    BussinessExcetionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BussinessException buildException(){
        return new BussinessException(this.code, this.msg);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static void main(String[] args) {
        try {
            throw BussinessExcetionEnum.INVOKE_ERROR.buildException();
        } catch (BussinessException e) {
            e.printStackTrace();
        }
    }
}
